<template>
	<u-sticky bg-color="#FFFFFF">
		<u-gap height="8" bgColor="#f8f8f8"></u-gap>
		<view class="flex flex-row items-center px-[16px] py-[10px] font-semibold text-[14px] text-[#333333]">
			<text>总会员数：</text>
			<text class="text-[#d81e06]">{{stat?.UserCount || 0}}</text>
			<text class="ml-[16px]">总业绩：</text>
			<text class="text-[#d81e06]">¥{{stat?.TeamPerformance || 0}}</text>
		</view>
		<u-gap height="8" bgColor="#f8f8f8"></u-gap>
		<u-tabs :list="tabList" :scrollable="false" lineColor="rgb(250,53,52)" :activeStyle="{ color: 'rgb(250,53,52)', fontWeight: 'bold', transform: 'scale(1.05)' }" 
				:inactiveStyle="{ color: '#606266', transform: 'scale(1)' }"></u-tabs>
	</u-sticky>
	<view class="pb-safe">
		<u-cell class="bg-[#FFFFFF]" v-for="(item,index) in dataList" :key="index" :label="item.AddDate" :title="`${item.NickName}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${item.UserName}`"></u-cell>
		<u-loadmore line status="nomore"></u-loadmore>
	</view>
</template>

<script setup>
	import {nextTick, ref} from "vue";
	import * as api from "@/api.js";
	import * as uniapp from "@dcloudio/uni-app";
	import {useUserStore} from "@/store/config.js";
	
	const store = useUserStore();
	const stat = ref();
	const dataList = ref([]);
	
	uniapp.onLoad(() => {
		getData();
	})
	
	const getData = async() => {
		uni.showLoading();
		const result = await api.getTeamList(store.user.UserID);
		uni.hideLoading();
		await nextTick();
		if(result[1]) {
			uni.showToast({
				icon:'none',
				title:result[1]
			})
		} else {
			stat.value = result[0].stat;
			dataList.value = result[0].data;
		}
	}
	
	const tabList = ref([{
		name:'推荐',
		value:0
	}])
	
</script>

<style>

</style>
